<?php
/**
 * ============================================================================
 * 版权所有 2008-2011 多多网络，并保留所有权利。
 * 网站地址: http://soft.duoduo123.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
exit();
session_start();
error_reporting(0);
include('comm/config.php');
include_once 'comm/checkpostandget.php';

$mall_id=(int)$_GET['mall_id'];
$act_id=(int)$_GET['act_id'];
$act_url=$_GET['url'];
$userid=$_SESSION['dduserid'];

if($act_id>0){
	$sql2="select a.url,b.name,b.fan from ".$BIAOTOU."activity as a,".$BIAOTOU."mall as b where a.id='".$act_id."' and a.mallid=b.id";//获取活动信息
    $query2=mysql_query($sql2);
    $mall=mysql_fetch_array($query2);
	$url=$mall['url'];
    $url=preg_replace('#&u_id=(.*?)#','&u_id='.$_SESSION['dduserid'],$url); //领克特添加会员ID
    $url=preg_replace('/&e=(.*?)&t/','&e='.$_SESSION['dduserid'].'&t',$url);//一起发添加会员ID
	$url=preg_replace('/&euid=(.*?)&t/','&euid='.$_SESSION['dduserid'].'&t',$url);//一起发、多麦添加会员ID
	$url=preg_replace('/&u=(.*?)&e/','&u='.$_SESSION['dduserid'].'&e',$url);//成果添加会员ID
}
elseif($mall_id>0 && $act_url==''){
    $sql="select * from ".$BIAOTOU."mall where id='".$mall_id."'";//获取商城信息
    $query=mysql_query($sql);
    $mall=mysql_fetch_array($query);
    if($mall['lm']=='linktech'){
        $url="http://click.linktech.cn/?m=".$mall['merchant']."&a=".MALLWZBH."&l=99999&l_cd1=0&l_cd2=1&tu=".urlencode($mall['url'])."&u_id=".$_SESSION['dduserid'];
    }
    elseif($mall['lm']=='yiqifa'){
        $url=preg_replace('/&e=(.*?)&t/','&e='.$_SESSION['dduserid'].'&t',$mall['yilink']);
    }
	elseif($mall['lm']=='duomai'){
        $url="http://c.duomai.com/track.php?sid=".DUOMAIID."&aid=".$mall['duomaiid']."&euid=".$_SESSION['dduserid']."&t=".urlencode($mall['url']);
    }
	elseif($mall['lm']=='chanet'){
        $url="http://count.chanet.com.cn/click.cgi?a=".CHANETWID."&d=".$mall['chanetid']."&u=".$_SESSION['dduserid']."&e=";
    }
}  
elseif($mall_id>0 && $act_url!=''){
	$sql="select merchant,lm,yilink,name,fan,duomaiid from ".$BIAOTOU."mall where id='".$mall_id."' limit 1";//获取商城信息
    $query=mysql_query($sql);
    $mall=mysql_fetch_array($query);
	
	if($mall['lm']=='linktech'){
        $url="http://click.linktech.cn/?m=".$mall['merchant']."&a=".MALLWZBH."&l=99999&l_cd1=0&l_cd2=1&tu=".$act_url."&u_id=".$userid;
    }
    elseif($mall['lm']=='yiqifa'){
        $url=preg_replace('/&e=(.*?)&t/','&e='.$userid.'&t',$mall['yilink']);
	    $qu=strstr($url,'&t=');
	    $url=str_replace($qu,'&t='.$act_url,$url);
    }
	elseif($mall['lm']=='duomai'){
        $url="http://c.duomai.com/track.php?sid=".DUOMAIID."&aid=".$mall['duomaiid']."&euid=".$_SESSION['dduserid']."&t=".$act_url;
    }
}
mysql_close();
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=WEBTITLE?>返现正在带您去 <?=$mall['name']?></title>
<style> 
#wrapper{position:absolute;left:50%;top:50%;width:454px;height:85px;padding:90px 17px;margin:-132px 0 0 -244px;text-align:center;font-size:12px;background:url(template/<?=MOBAN?>/images/logo.gif) no-repeat; border:2px #CCCCCC solid;}
#loading{position:absolute;right:22px;top:30px}
#desc{height:45px;font-size:14px;font-weight:bold}
#desc big{font-size:16px;color:#f00}
#action{color:#666}
#action a{color:#f00;text-decoration:none}
#tip{position:absolute;bottom:29px;left:19px;width:454px;line-height:35px;color:#666}
iframe{display:none}
</style>
</head>
<body><form name="loading" style=" width:100%; height:30px; margin:0px;"> 
 <iframe src ="<?=$mall['url']?>"></iframe><div id="wrapper">
	<img id="loading" src="template/<?=MOBAN?>/images/cps_redirecting.gif" alt="正在转向"/>
	<div id="desc"><?=WEBTITLE?>正在带您去<big><?=$mall['name']?></big>（最高返<span style='color:#BD0000;'><?=$mall['fan']?></span>），请稍等</div>
	<div id="action">如果您的浏览器没有自动跳转，请<a href="<?=$url?>">点击这里</a></div>
	<div id="tip">
<font color="#0066ff">正在转入购物网站，请稍等</font><font color="#0066ff" size="2" face="Arial">...</font><br>
<input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#fe6d01; background-color:#fff; padding:0px; border-style:none;">
<input name=percent size=47 style="color:#0066ff; text-align:center; border-width:medium; border-style:none;" type="hidden">
<script>　 
var bar=0　 
var line="||"　 
var amount="||"　 
count()　 
function count(){　 
bar=bar+2　 
amount =amount + line　 
document.loading.chart.value=amount　 
document.loading.percent.value=bar+"%"　 
if (bar<99)　 
{setTimeout("count()",10);}　 
else　 
{
window.location='<?=$url?>';
}　 
}</script> 
　</p> 
 </div>
</div></form>
</body>
</html>

